
//============================ Vinh add =========================
function desibleCAPNHAT(myform,idParam)
{
	myform.elements[idParam].disabled = true;
}
function open_desibleCAPNHAT(myform,idParam,txtBox)
{
	var temp = myform.elements[txtBox].value;
	if(temp == '')
		myform.elements[idParam].disabled = true;
	else
		myform.elements[idParam].disabled = false;
}
//============================ End Vinh add =====================

function changetype(myform,lblname){
	if(myform.elements[lblname].readOnly){
		//alert("readOnly");
		myform.elements[lblname].readOnly = false;
		
	}else{
		if(myform.elements[lblname].disabled){
			//alert("disabled");
			myform.elements[lblname].disabled = false;
			
		}else{
			//alert("No script");	
		}
	}
	
}

function activeform(myform,f_name){
	var form = document.forms[myform.name];
	if(form.find){
		form.find.disabled = false;
	}
	if(form.find2){
		form.find2.disabled = false;
	}
	if(form.findmicro){
		form.findmicro.disabled = false;	
	}
	
	if(form.duyet){
		form.duyet.disabled = true;
	}
	if(form.tuchoi){
		form.tuchoi.disabled = true;
	}
	if(form.capnhat){
		form.capnhat.disabled = true;	
	}
	if(form.next){
		form.next.disabled = true;	
	}
	
	var lblname = f_name.split('-');
	if(lblname.length<=1){
		changetype(form,lblname);
	}else{
		for(i=0;i<lblname.length;i++){
			changetype(form,lblname[i]);
		}
	}
	
	
	//alert(f_name);
	/*if(f_name=='USRID'){
		document.forms[myform.name].USRID.readOnly = false;
		return;
	}
	if(f_name=='ODTYPE'){
		document.forms[myform.name].ODTYPE.readOnly = false;
		return;
	}
	if(f_name=='ACCTNO'){
		document.forms[myform.name].ACCTNO.readOnly = false;
		document.forms[myform.name].CURCODE.disabled  = false;
		return;
	}
	if(f_name=='SBVACCT'){
		document.forms[myform.name].SBVACCT.readOnly = false;
		return;
	}
	if(f_name=='PRDCODE'){
		document.forms[myform.name].PRDCODE.readOnly = false;
		return;
	}
	if(f_name=='POSID'){
		document.forms[myform.name].POSID.readOnly = false;
		return;
	}
	if(f_name=='BRNCODE'){
		document.forms[myform.name].BRNCODE.readOnly = false;
		return;
	}
	if(f_name=='AGENTID'){
		document.forms[myform.name].AGENTID.readOnly = false;
		return;
	}
	if(f_name=='PRDGRP'){
		document.forms[myform.name].PRDGRP.readOnly = false;
		return;
	}
	if(f_name=='PENTYPE'){
		document.forms[myform.name].PENTYPE.readOnly = false;
		document.forms[myform.name].BRNCODE.readOnly = false;
		return;
	}
	if(f_name=='CODE'){
		document.forms[myform.name].CODE.readOnly = false;
		document.forms[myform.name].BRNCODE.readOnly = false;
		return;
	}
	
	if(f_name=='SBRCODE'){
		document.forms[myform.name].SBRCODE.readOnly = false;
		document.forms[myform.name].BRNCODE.readOnly = false;
		return;
	}
	
	if(f_name=='I_CODE'){
		document.forms[myform.name].CODE.readOnly = false;
		return;
	}
	
	if(f_name=='PARNAME'){
		document.forms[myform.name].PARNAME.readOnly = false;
		return;
	}
	
	if(f_name=='PARMCODE'){
		document.forms[myform.name].PARMCODE.readOnly = false;
		return;
	}
	if(f_name=='RPTGRPID'){
		document.forms[myform.name].RPTGRPID.readOnly = false;
		return;
	}
	//cashgrouplist
	if(f_name=='CSHGRPID'){
		document.forms[myform.name].CSHGRPID.readOnly = false;
		return;
	}
	//cashgroup
	if(f_name=='I_CSHGRPID'){
		document.forms[myform.name].CSHGRPID.disabled = false;
		document.forms[myform.name].CURRCODE.disabled  = false;
		return;
	}
	if(f_name=='MID'){
		document.forms[myform.name].MID.readOnly = false;
		return;
	}
	if(f_name=='MENUID'){
		document.forms[myform.name].MENUID.readOnly = false;
		return;
	}
	if(f_name=='TXNLEVELID'){
		document.forms[myform.name].TXNLEVELID.readOnly = false;
		return;
	}
	if(f_name=='TXNCODE'){
		document.forms[myform.name].TXNCODE.readOnly = false;
		return;
	}
	if(f_name=='CURTYPE'){
		document.forms[myform.name].CURTYPE.readOnly = false;
		document.forms[myform.name].CURCODE.readOnly = false;
		return;
	}
	*/
	
}

function activeform_2(myform,f_name){
	var form = document.forms[myform.name];
	if(form.find){
		form.find.disabled = false;
	}
	if(form.find2){
		form.find2.disabled = false;
	}
	if(form.findmicro){
		form.findmicro.disabled = false;	
	}
	if(form.replacement_binoculars){
		form.replacement_binoculars.disabled = false;
	}
	
	if(form.duyet){
		form.duyet.disabled = true;
	}
	if(form.tuchoi){
		form.tuchoi.disabled = true;
	}
	if(form.capnhat){
		form.capnhat.disabled = true;	
	}
	if(form.next){
		form.next.disabled = true;	
	}
	
	var lblname = f_name.split('-');
	if(lblname.length<=1){
		changetype(form,lblname);
	}else{
		for(i=0;i<lblname.length;i++){
			changetype(form,lblname[i]);
		}
	}
	
}

